<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateSystemUserLogin extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        \common\extra\MigrateFast::create(
            $this->table('system_user_login'),
            [
                ['user_id', 'integer', ['comment' => '角色ID']],
                ['ip', 'string', ['comment' => '登录地址']],
                ['agent', 'string', ['comment' => '登录标识']],
                ['languages', 'string', ['comment' => '语言']],
                ['device', 'string', ['comment' => '内核', 'default' => '']],
                ['browser', 'string', ['comment' => '浏览器', 'default' => '']],
                ['version_browser', 'string', ['comment' => '浏览器版本', 'default' => '']],
                ['platform', 'string', ['comment' => '平台 安卓，ios，win等', 'default' => '']],
                ['version_platform', 'string', ['comment' => '平台版本', 'default' => '']],
                ['phone', 'integer', ['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY, 'comment' => '是否移动端', 'default' => 0]],
                ['robot', 'string', ['comment' => '机器人', 'default' => '']],
            ]
        );
    }
}
